home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / the_independent.swf / scripts / DefineSprite_25_fpsCounter / frame_1 / DoAction.as
Text File  |  2011-08-19  |  528b  |  23 lines

  1. startTime = getTimer() / 1000;
  2. frames = 0;
  3. tenSec = 0;
  4. tenTotal = 0;
  5. this.onenterframe = function()
  6. {
  7.    frames++;
  8.    if(getTimer() - startTime > count)
  9.    {
  10.       count += 1000;
  11.       tenTotal += math.round(3.225806451612903 * frames);
  12.       tenSec++;
  13.       fps.text = "1 sec: " + math.round(3.225806451612903 * frames) + "%";
  14.       if(tenSec == 10)
  15.       {
  16.          tenfps.text = "10 sec: " + math.round(tenTotal / 10) + "%";
  17.          tenSec = 0;
  18.          tenTotal = 0;
  19.       }
  20.       frames = 0;
  21.    }
  22. };
  23.